package com.scsj.supermarket.view.activity.orderpaymodel;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.scsj.supermarket.R;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;

/**
 * 订单支付页面
 */

public class OrderPayActivity extends BaseActivity implements View.OnClickListener {

    private RelativeLayout rlAlipay;
    private RelativeLayout rlWeichatPay;
    private RelativeLayout rlBankCardPay;
    private RelativeLayout rlAccountPay;
    private ImageView ivAlipay;
    private ImageView ivWeichatPay;
    private ImageView ivBankCardPay;
    private ImageView ivAccountPay;

    @Override
    protected void createView(Bundle savedInstanceState) {

        setContentView(R.layout.activity_pay_layout);
    }

    @Override
    protected void initView() {

        rlAlipay = findViewById(R.id.pay_zhifubao_rl);
        rlWeichatPay = findViewById(R.id.pay_weixin_rl);
        rlBankCardPay = findViewById(R.id.pay_bank_rl);
        rlAccountPay = findViewById(R.id.pay_account_rl);
        ivAlipay = findViewById(R.id.iv_alipay);
        ivWeichatPay = findViewById(R.id.iv_weixin_pay);
        ivBankCardPay = findViewById(R.id.iv_bankcard_pay);
        ivAccountPay = findViewById(R.id.iv_account_pay);
    }

    @Override
    protected void initListener() {
        rlAlipay.setOnClickListener(this);
        rlWeichatPay.setOnClickListener(this);
        rlBankCardPay.setOnClickListener(this);
        rlAccountPay.setOnClickListener(this);

    }

    @Override
    protected void initData() {
    }

    @Override
    public void onClick(View view) {

        switch (view.getId()) {

            case R.id.pay_zhifubao_rl:
                ivAlipay.setImageDrawable(getResources().getDrawable(R.mipmap.check_select));
                ivWeichatPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivBankCardPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivAccountPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                Toast.makeText(this, "支付宝", Toast.LENGTH_LONG).show();
                break;
            case R.id.pay_weixin_rl:
                Toast.makeText(this, "微信", Toast.LENGTH_LONG).show();
                ivAlipay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivWeichatPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_select));
                ivBankCardPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivAccountPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                break;
            case R.id.pay_bank_rl:
                ivAlipay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivWeichatPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivBankCardPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_select));
                ivAccountPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                Toast.makeText(this, "银行卡", Toast.LENGTH_LONG).show();
                break;
            case R.id.pay_account_rl:
                ivAlipay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivWeichatPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivBankCardPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_no_select));
                ivAccountPay.setImageDrawable(getResources().getDrawable(R.mipmap.check_select));
                Toast.makeText(this, "余额", Toast.LENGTH_LONG).show();
                break;
            default:
                break;
        }
    }
}
